unit CadastroGrupo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UFomCadastro, DBCtrls, StdCtrls, Buttons, ExtCtrls, DB,
  DBTables, Mask;

type
  TFCadastroGrupo = class(TFormCadastro)
    Label2: TLabel;
    edDescricao: TDBEdit;
    QCadastro: TQuery;
    dsCadastro: TDataSource;
    DBRadioGroup1: TDBRadioGroup;
    procedure BtnIncluirClick(Sender: TObject);
    procedure BtnEditarClick(Sender: TObject);
    procedure BtnExcluirClick(Sender: TObject);
    procedure BtnSalvarClick(Sender: TObject);
    procedure BtnCancelarClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BtnConsutaClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FCadastroGrupo: TFCadastroGrupo;

implementation

uses UGestao, UGeral, UPesquisaGrupos;

{$R *.dfm}

procedure TFCadastroGrupo.BtnIncluirClick(Sender: TObject);
begin
  dsCadastro.DataSet.Insert;
  inherited;
  dsCadastro.DataSet.FieldByname('GRUP_TIPO').AsString := 'Geral';
  edDescricao.SetFocus;
end;

procedure TFCadastroGrupo.BtnEditarClick(Sender: TObject);
begin
  dsCadastro.DataSet.Edit;
  inherited;
  edDescricao.SetFocus;
end;

procedure TFCadastroGrupo.BtnExcluirClick(Sender: TObject);
begin
  dsCadastro.DataSet.Delete;
  inherited;

end;

procedure TFCadastroGrupo.BtnSalvarClick(Sender: TObject);
begin
  dsCadastro.DataSet.Post;
  inherited;

end;

procedure TFCadastroGrupo.BtnCancelarClick(Sender: TObject);
begin
  dsCadastro.DataSet.Cancel;
  inherited;

end;

procedure TFCadastroGrupo.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  FCadastroGrupo.Release;
  FCadastroGrupo := nil;
end;

procedure TFCadastroGrupo.BtnConsutaClick(Sender: TObject);
begin
  inherited;
  Application.CreateForm(TFPesquisaGrupos, FPesquisaGrupos);
  FPesquisaGrupos.Showmodal;
  FPesquisaGrupos.Free;
end;

end.
